package com.clf.springBoot.modules.account.service.impl;

import com.clf.springBoot.modules.account.dao.ResourceDao;
import com.clf.springBoot.modules.account.entity.Resource;
import com.clf.springBoot.modules.account.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * @Author: chenglongfei
 * @date: 2022/7/10
 * @Description ResourceServiceImpl
 */
@Service
public class ResourceServiceImpl implements ResourceService {


    @Autowired
    private ResourceDao resourceDao;

    @Override
    public List<Resource> getResourcesByRoleId(int roleId) {
        return Optional
                .ofNullable(resourceDao.getResourcesByRoleId(roleId))
                .orElse(Collections.emptyList());
    }
}
